Dynomotion

Group: DynoMotion Message: 7789 From: Steve Date: 6/26/2013
Subject: Kflop does not do homing with MACH???
After solving the optical switch delema and installing and wiring X,Y,Z and A home switches, I find that there is no ability to actually home if using the Kflop?

It this actually the case? Each user has to write their own homing code in C?

Surely there must be a homing program that mimics MACHs process.

Little help here, PLEASE!

- Steve
Group: DynoMotion Message: 7791 From: Tom Kerekes Date: 6/27/2013
Subject: Re: Kflop does not do homing with MACH???
Hi Steve,

Yes you must write your own homing code.  This method allow flexibility and allows KMotionCNC, Mach3, or any other PC App to use the same method.  Homing some complex machines can be very involved.

In your case I would start with SimpleHome3Axis.c and modify the values for your system.  Run it from KMotion.exe to verify it and your hardware works.  Then copy and paste each Axis into the Mach3Home.c program.

Regards
TK

Group: DynoMotion Message: 7794 From: Steve Date: 6/27/2013
Subject: Re: Kflop does not do homing with MACH???

I found HomeEncoderMach3.c which had enough clues for me to get a homing program cobbled together for the first 4 axis. Direct reading of the input state via:

while (ReadBit(xx))

is unreliable (on my system).

Your mileage may vary, but I found that only by reading the port into a variable and then checking the variable does is seem to settle down. Compiler SNAFU maybe?

Question:

The X axis sensor is at X7.0" and the Z sensor is at the top of travel (Z16.5 approx). Therefor at the end of the homing sequence X DRO should read 7.0" and Z should read 16.5"

How are these values entered into MACH thru the homing program?

Thanks,

Steve

 

 

 

 


--- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
>
> Hi Steve,
>
> Yes you must write your own homing code.  This method allow flexibility and allows KMotionCNC, Mach3, or any other PC App to use the same method.  Homing some complex machines can be very involved.
>
> In your case I would start with SimpleHome3Axis.c and modify the values for your system.  Run it from KMotion.exe to verify it and your hardware works.  Then copy and paste each Axis into the Mach3Home.c program.
>
>
> Regards
> TK
>
>
>
> ________________________________
> From: Steve steve@...
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, June 26, 2013 4:21 PM
> Subject: [DynoMotion] Kflop does not do homing with MACH???
>
>
>
>  
> After solving the optical switch delema and installing and wiring X,Y,Z and A home switches, I find that there is no ability to actually home if using the Kflop?
>
> It this actually the case? Each user has to write their own homing code in C?
>
> Surely there must be a homing program that mimics MACHs process.
>
> Little help here, PLEASE!
>
> - Steve
>

Group: DynoMotion Message: 7796 From: tapiolarikka Date: 6/28/2013
Subject: Re: Kflop does not do homing with MACH???
Hi Steve!

I can send you a copy of my homing with Mach if you want.

Rgds,
Tapio

--- In DynoMotion@yahoogroups.com, "Steve" <steve@...> wrote:
>
>
> I found HomeEncoderMach3.c which had enough clues for me to get a homing
> program cobbled together for the first 4 axis. Direct reading of the
> input state via:
>
> while (ReadBit(xx))
>
> is unreliable (on my system).
>
> Your mileage may vary, but I found that only by reading the port into a
> variable and then checking the variable does is seem to settle down.
> Compiler SNAFU maybe?
>
> Question:
>
> The X axis sensor is at X7.0" and the Z sensor is at the top of travel
> (Z16.5 approx). Therefor at the end of the homing sequence X DRO should
> read 7.0" and Z should read 16.5"
>
> How are these values entered into MACH thru the homing program?
>
> Thanks,
>
> Steve
>
>
>
>
>
>
>
>
>
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> >
> > Hi Steve,
> >
> > Yes you must write your own homing code. This method allow
> flexibility and allows KMotionCNC, Mach3, or any other PC App to use the
> same method. Homing some complex machines can be very involved.
> >
> > In your case I would start with SimpleHome3Axis.c and modify the
> values for your system. Run it from KMotion.exe to verify it and
> your hardware works. Then copy and paste each Axis into the
> Mach3Home.c program.
> >
> >
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: Steve steve@
> > To: DynoMotion@yahoogroups.com
> > Sent: Wednesday, June 26, 2013 4:21 PM
> > Subject: [DynoMotion] Kflop does not do homing with MACH???
> >
> >
> >
> > Â
> > After solving the optical switch delema and installing and wiring
> X,Y,Z and A home switches, I find that there is no ability to actually
> home if using the Kflop?
> >
> > It this actually the case? Each user has to write their own homing
> code in C?
> >
> > Surely there must be a homing program that mimics MACHs process.
> >
> > Little help here, PLEASE!
> >
> > - Steve
> >
>
Group: DynoMotion Message: 7800 From: Steve Date: 6/28/2013
Subject: Re: Kflop does not do homing with MACH???


Tapio,

Thanks for the offer. I have a working home program. I just need to know how to set the DROs in MACH.

I've tried a couple of things in the code, but no joy so far and it's just shots in the dark.

If anybody has the answer please post.

Thanks,

Steve

 

 

--- In DynoMotion@yahoogroups.com, "tapiolarikka" wrote:
>
> Hi Steve!
>
> I can send you a copy of my homing with Mach if you want.
>
> Rgds,
> Tapio
>
> --- In DynoMotion@yahoogroups.com, "Steve" steve@ wrote:
> >
> >
> > I found HomeEncoderMach3.c which had enough clues for me to get a homing
> > program cobbled together for the first 4 axis. Direct reading of the
> > input state via:
> >
> > while (ReadBit(xx))
> >
> > is unreliable (on my system).
> >
> > Your mileage may vary, but I found that only by reading the port into a
> > variable and then checking the variable does is seem to settle down.
> > Compiler SNAFU maybe?
> >
> > Question:
> >
> > The X axis sensor is at X7.0" and the Z sensor is at the top of travel
> > (Z16.5 approx). Therefor at the end of the homing sequence X DRO should
> > read 7.0" and Z should read 16.5"
> >
> > How are these values entered into MACH thru the homing program?
> >
> > Thanks,
> >
> > Steve
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > >
> > > Hi Steve,
> > >
> > > Yes you must write your own homing code. This method allow
> > flexibility and allows KMotionCNC, Mach3, or any other PC App to use the
> > same method. Homing some complex machines can be very involved.
> > >
> > > In your case I would start with SimpleHome3Axis.c and modify the
> > values for your system. Run it from KMotion.exe to verify it and
> > your hardware works. Then copy and paste each Axis into the
> > Mach3Home.c program.
> > >
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > > ________________________________
> > > From: Steve steve@
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Wednesday, June 26, 2013 4:21 PM
> > > Subject: [DynoMotion] Kflop does not do homing with MACH???
> > >
> > >
> > >
> > > Â
> > > After solving the optical switch delema and installing and wiring
> > X,Y,Z and A home switches, I find that there is no ability to actually
> > home if using the Kflop?
> > >
> > > It this actually the case? Each user has to write their own homing
> > code in C?
> > >
> > > Surely there must be a homing program that mimics MACHs process.
> > >
> > > Little help here, PLEASE!
> > >
> > > - Steve
> > >
> >
>

Group: DynoMotion Message: 7801 From: Tom Kerekes Date: 6/28/2013
Subject: Re: Kflop does not do homing with MACH???
Hi Steve,

I thought I sent this yesterday but I can't find it in the yahoo Group (Blasted Yahoo)...

Please see if this allows you to "Set your DROs"

Regards
TK

Group: DynoMotion Message: 7803 From: Steve Date: 6/28/2013
Subject: Re: Kflop does not do homing with MACH???

It was not a syntax issue. There was random garbage coming from somewhere.

I cannot give you the actual code becuase it is long gone replaced by other iterations until I got something that worked. The while statement was supposed to find a state change, but it was not reading the port at all. i.e. no movement regardless of what the port state was. And no movement regardless of whether looking or "!" state.

To investigate, I started having the program print out what it was doing and a lot of the data it was getting from the while statement was garbage. It looked like a timing issue and I have had success in the past by assigning data reads to variables and then using the variable instead if the read. Perhaps it works because it slows execution or engages interrupts for the variable handling (just speculating here, I don't know why it works).

In any case, I kept dinking around with it untill I ended up with this cobbled together program. The paint is still wet and I make no warranties of any kind to anyone for any purpose, but it may have some value as an example, so this is what I have at the moment:

http://www.thecubestudio.com/Kflop/HomeMach3Simpson.c

The 'debugging' output is now orderly as shown in this captured file:

http://www.thecubestudio.com/Kflop/HomingDegugOutput.txt

It works for the moment and that's about all I have time for.

I messed with the EnableAxisDest(XXX), but had no success.  The * steps per inch was a missing ingredient. I'll give that a try and see if The DROs respond.

Thanks for the info.

- Steve

 

 


--- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
>
> Hi Steve,
>
> I thought I sent this yesterday but I can't find it in the yahoo Group (Blasted Yahoo)...
>
> Please see if this allows you to "Set your DROs"
>
> Regards
> TK
>
>
>
> ________________________________
> From: Tom Kerekes tk@...
> To: "DynoMotion@yahoogroups.com" DynoMotion@yahoogroups.com
> Sent: Thursday, June 27, 2013 2:15 PM
> Subject: Re: [DynoMotion] Re: Kflop does not do homing with MACH???
>
>
>
> Hi Steve,
>
> If you post your code we can check it for a mistake.  Maybe you are missing the semicolon after the "while"?  The "while" statement will repeat the next statement while looping.  We typically want to do nothing while waiting so we put nothing and then a semicolon.   A common mistake in C is to forget the semicolon which doesn't cause a compile error but the following statement whatever it is gets repeatedly executed in the while loop.
>
>
> Regarding setting the initial machine position:  with simple open loop steppers you can just set the desired position when you enable the Axis with something like:
>
> #define XSTEPS_PER_INCH 10000.0
>
> EnableAxisDest(0,7.0 * XSTEPS_PER_INCH);
>
>
> HTH
> Regards
> TK
>
>
>
>
>
> ________________________________
> From: Steve steve@...
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, June 27, 2013 11:55 AM
> Subject: [DynoMotion] Re: Kflop does not do homing with MACH???
>
>
>
>  
> I found HomeEncoderMach3.c which had enough clues for me to get a homing program cobbled together for the first 4 axis. Direct reading of the input state via:while(ReadBit(xx))
> is unreliable (on my system).
> Your mileage may vary, but I found that only by reading the port into a variable and then checking the variable does is seem to settle down. Compiler SNAFU maybe?
> Question:
> The X axis sensor is at X7.0" and the Z sensor is at the top of travel (Z16.5 approx). Therefor at the end of the homing sequence X DRO should read 7.0" and Z should read 16.5"
> How are these values entered into MACH thru the homing program?
> Thanks,
> Steve
>  
>  
>  
>  
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> >
> > Hi Steve,
> >
> > Yes you must write your own homing code.  This method allow flexibility and allows KMotionCNC, Mach3, or any other PC App to use the same method.  Homing some complex machines can be very involved.
> >
> > In your case I would start with SimpleHome3Axis.c and modify the values for your system.  Run it from KMotion.exe to verify it and your hardware works.  Then copy and paste each Axis into the Mach3Home.c program.
> >
> >
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: Steve steve@
> > To: DynoMotion@yahoogroups.com
> > Sent: Wednesday, June 26, 2013 4:21 PM
> > Subject: [DynoMotion] Kflop does not do homing with MACH???
> >
> >
> >
> >  
> > After solving the optical switch delema and installing
> and wiring X,Y,Z and A home switches, I find that there is no ability to actually home if using the Kflop?
> >
> > It this actually the case? Each user has to write their own homing code in C?
> >
> > Surely there must be a homing program that mimics MACHs process.
> >
> > Little help here, PLEASE!
> >
> > - Steve
> >
>

Group: DynoMotion Message: 7804 From: Steve Date: 6/28/2013
Subject: Re: Kflop does not do homing with MACH???

"STEPS_PER_INCH" did the trick!  DROs are now set properly at the end of homing.

Now on to the A,B, and C axis homing. Once all of this is working, I may find time to clean up the homing program and try to get a better understanding of exactly what's going on. For now I have it spitting out a bunch of stuff on the console so that I can 'see' what it is doing.

I already have code that homes the 4th axis ("A" axis) so I am hoping that a MACH macro call to home the axis will be passed to the Kflop program.

Thanks for the info and offers of assistance.

- Steve

 

 

 

 

--- In DynoMotion@yahoogroups.com, "Steve" wrote:
>
>
> It was not a syntax issue. There was random garbage coming from
> somewhere.
>
> I cannot give you the actual code becuase it is long gone replaced by
> other iterations until I got something that worked. The while statement
> was supposed to find a state change, but it was not reading the port at
> all. i.e. no movement regardless of what the port state was. And no
> movement regardless of whether looking or "!" state.
>
> To investigate, I started having the program print out what it was doing
> and a lot of the data it was getting from the while statement was
> garbage. It looked like a timing issue and I have had success in the
> past by assigning data reads to variables and then using the variable
> instead if the read. Perhaps it works because it slows execution or
> engages interrupts for the variable handling (just speculating here, I
> don't know why it works).
>
> In any case, I kept dinking around with it untill I ended up with this
> cobbled together program. The paint is still wet and I make no
> warranties of any kind to anyone for any purpose, but it may have some
> value as an example, so this is what I have at the moment:
>
> http://www.thecubestudio.com/Kflop/HomeMach3Simpson.c
>
>
> The 'debugging' output is now orderly as shown in this captured file:
>
> http://www.thecubestudio.com/Kflop/HomingDegugOutput.txt
>
>
> It works for the moment and that's about all I have time for.
>
> I messed with the EnableAxisDest(XXX), but had no success. The * steps
> per inch was a missing ingredient. I'll give that a try and see if The
> DROs respond.
>
> Thanks for the info.
>
> - Steve
>
>
>
>
>
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> >
> > Hi Steve,
> >
> > I thought I sent this yesterday but I can't find it in the yahoo Group
> (Blasted Yahoo)...
> >
> > Please see if this allows you to "Set your DROs"
> >
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: Tom Kerekes tk@
> > To: "DynoMotion@yahoogroups.com" DynoMotion@yahoogroups.com
> > Sent: Thursday, June 27, 2013 2:15 PM
> > Subject: Re: [DynoMotion] Re: Kflop does not do homing with MACH???
> >
> >
> >
> > Hi Steve,
> >
> > If you post your code we can check it for a mistake. Maybe you
> are missing the semicolon after the "while"? The "while" statement
> will repeat the next statement while looping. We typically want to
> do nothing while waiting so we put nothing and then a semicolon.Â
> Â A common mistake in C is to forget the semicolon which doesn't
> cause a compile error but the following statement whatever it is gets
> repeatedly executed in the while loop.
> >
> >
> > Regarding setting the initial machine position:Â with simple open
> loop steppers you can just set the desired position when you enable the
> Axis with something like:
> >
> > #define XSTEPS_PER_INCH 10000.0
> >
> > EnableAxisDest(0,7.0 * XSTEPS_PER_INCH);
> >
> >
> > HTH
> > Regards
> > TK
> >
> >
> >
> >
> >
> > ________________________________
> > From: Steve steve@
> > To: DynoMotion@yahoogroups.com
> > Sent: Thursday, June 27, 2013 11:55 AM
> > Subject: [DynoMotion] Re: Kflop does not do homing with MACH???
> >
> >
> >
> > Â
> > I found HomeEncoderMach3.c which had enough clues for me to get a
> homing program cobbled together for the first 4 axis. Direct reading of
> the input state via:while(ReadBit(xx))
> > is unreliable (on my system).
> > Your mileage may vary, but I found that only by reading the port into
> a variable and then checking the variable does is seem to settle down.
> Compiler SNAFU maybe?
> > Question:
> > The X axis sensor is at X7.0" and the Z sensor is at the top of travel
> (Z16.5 approx). Therefor at the end of the homing sequence X DRO should
> read 7.0" and Z should read 16.5"
> > How are these values entered into MACH thru the homing program?
> > Thanks,
> > Steve
> > Â
> > Â
> > Â
> > Â
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > >
> > > Hi Steve,
> > >
> > > Yes you must write your own homing code. This method allow
> flexibility and allows KMotionCNC, Mach3, or any other PC App to use the
> same method. Homing some complex machines can be very involved.
> > >
> > > In your case I would start with SimpleHome3Axis.c and modify the
> values for your system. Run it from KMotion.exe to verify it and
> your hardware works. Then copy and paste each Axis into the
> Mach3Home.c program.
> > >
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > > ________________________________
> > > From: Steve steve@
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Wednesday, June 26, 2013 4:21 PM
> > > Subject: [DynoMotion] Kflop does not do homing with MACH???
> > >
> > >
> > >
> > > ÂÂ
> > > After solving the optical switch delema and installing
> > and wiring X,Y,Z and A home switches, I find that there is no ability
> to actually home if using the Kflop?
> > >
> > > It this actually the case? Each user has to write their own homing
> code in C?
> > >
> > > Surely there must be a homing program that mimics MACHs process.
> > >
> > > Little help here, PLEASE!
> > >
> > > - Steve
> > >
> >
>

Group: DynoMotion Message: 7816 From: Tom Kerekes Date: 6/29/2013
Subject: Re: Kflop does not do homing with MACH???
Hi Steve,

If you post your code we can check it for a mistake.  Maybe you are missing the semicolon after the "while"?  The "while" statement will repeat the next statement while looping.  We typically want to do nothing while waiting so we put nothing and then a semicolon.   A common mistake in C is to forget the semicolon which doesn't cause a compile error but the following statement whatever it is gets repeatedly executed in the while loop.

Regarding setting the initial machine position:  with simple open loop steppers you can just set the desired position when you enable the Axis with something like:

#define XSTEPS_PER_INCH 10000.0
EnableAxisDest(0,7.0 * XSTEPS_PER_INCH);

HTH
Regards
TK